UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 't5/fWM79Ln0MgmWiNxcTzyfuUAMGZGtmD9uDgX4+4qs=' 
WHERE 
  key_id = '1ec81788fcf88d3ed2c21e85cf8f1596fe3fcc47b56a2d1df70f968d1e9e6205' 
  AND (
    token = 't5/fWM79Ln0MgmWiNxcTzyfuUAMGZGtmD9uDgX4+4qs=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00022