UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'LaNvjjVjY1GyZSzwfrRmf+aUmk/qkp4uCy+VkwnONmA=' 
WHERE 
  key_id = 'f0111c669e72c8100fa1dd8eeebe007219b7a3e729bb455d2f0e6aeeb17fbee5' 
  AND (
    token = 'LaNvjjVjY1GyZSzwfrRmf+aUmk/qkp4uCy+VkwnONmA=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00020