UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'IIoWRYKSCthYd+2e94EwVEZytTOEsL7i8aMHCWrtLSU=' 
WHERE 
  key_id = '3e4727af265d38d8236d2771f0daa5dfe0b4edb477c305966d5e5e1fbca41440' 
  AND (
    token = 'IIoWRYKSCthYd+2e94EwVEZytTOEsL7i8aMHCWrtLSU=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00031