UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'I78LAkfg1N5HJ1j2QXx4NF/faAPBXTKHdUW77NtuMew=' 
WHERE 
  key_id = '5cca594e608b26f9c043647157dc052c4cbe02d2926d5ed1002394880ba0f218' 
  AND (
    token = 'I78LAkfg1N5HJ1j2QXx4NF/faAPBXTKHdUW77NtuMew=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00020