UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'aO4a6KQiPEoYryjMBVFZ9Ed7edwRawrql/AzpcPt+hE=' 
WHERE 
  key_id = '1e78767f7d833ca803ca9470d373441077de1e575cf1e366504000bc0770f135' 
  AND (
    token = 'aO4a6KQiPEoYryjMBVFZ9Ed7edwRawrql/AzpcPt+hE=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00022