UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'orSnp3rXigb6RjrQyFsZaswLUMQdBbIF+TxnkkxRtjY=' 
WHERE 
  key_id = '4a8f971aa019f138caf1f91612aa374b0abbc1c4d6838aaedfa12818f03f4a7b' 
  AND (
    token = 'orSnp3rXigb6RjrQyFsZaswLUMQdBbIF+TxnkkxRtjY=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00035