UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'rFScm9OzCdldasjZqwi3LsqYFPMWOHdl6wGHZhdQ2mI=' 
WHERE 
  key_id = 'e4e2478d73c927d2b06f0585db094b4b2a876afc3e3c404c3820f380187555a4' 
  AND (
    token = 'rFScm9OzCdldasjZqwi3LsqYFPMWOHdl6wGHZhdQ2mI=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00028