UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = '6Vs4/nluPVjT5EFttbJmsZGeFN5iNuBJNkz7UkFFUlk=' 
WHERE 
  key_id = '787b0413da84d774b59d2b5c022bbd2f88105e93c89fe85826b10a55299aa980' 
  AND (
    token = '6Vs4/nluPVjT5EFttbJmsZGeFN5iNuBJNkz7UkFFUlk=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00023