UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'M7uw8e9Ceq6MEfLw45+3U+YFo+zX16OqQuOf3VrAW/Q=' 
WHERE 
  key_id = 'dd27c6c67ef28a5054418df23b50e78a9d86bdff20c624ca2404f1c4aea1f4e5' 
  AND (
    token = 'M7uw8e9Ceq6MEfLw45+3U+YFo+zX16OqQuOf3VrAW/Q=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00030