UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'Q8bxk2IkfIvowyDCXL3uW9OIuHtf2bOeSy0xyLoPfRU=' 
WHERE 
  key_id = '1345239ea65268e0627d98e4f3f8f77102a7e480814e9e004b0ff8558f23501c' 
  AND (
    token = 'Q8bxk2IkfIvowyDCXL3uW9OIuHtf2bOeSy0xyLoPfRU=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00041