UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'G5ejZM4v76Auh8bFq8LVZU/dVhgMGabZipOar4rwDOU=' 
WHERE 
  key_id = 'cbc5965aa4266f7aae7d5cdd694e2cfda30b468bb50ae4629dc31d388d288f9d' 
  AND (
    token = 'G5ejZM4v76Auh8bFq8LVZU/dVhgMGabZipOar4rwDOU=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00036