UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'ZZ3KY+6L7oozvjL3LEKMdAUXASUhmRyfABOQ9kAx1xo=' 
WHERE 
  key_id = '99e5ecd222b006cd24e696282bad51f66875020a1638960e37a957edfac3ed2c' 
  AND (
    token = 'ZZ3KY+6L7oozvjL3LEKMdAUXASUhmRyfABOQ9kAx1xo=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00041