UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'KdXstcmW8mKIF7d48Yg/pD+5lLTn3jWrPhq1I7F4pog=' 
WHERE 
  key_id = '18e28f990a7e58e1d392530625e99aabfbf0ef97597215a0421ad42082186dd0' 
  AND (
    token = 'KdXstcmW8mKIF7d48Yg/pD+5lLTn3jWrPhq1I7F4pog=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00028