UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'YEAAmtpK+vNn5igmPLsJDdRPOsYgWauSfxkDSRag5f8=' 
WHERE 
  key_id = 'f44fda38eb811de60a42776ca4179d4ceae1f0298f199c03c91c534d71b80f34' 
  AND (
    token = 'YEAAmtpK+vNn5igmPLsJDdRPOsYgWauSfxkDSRag5f8=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00026