UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = '6AFt1cyvfrGhwpJTt6FG0O91KUWsft5r7gyjOFVDF98=' 
WHERE 
  key_id = 'b6baadc4c7bc5714d7e92cc8c747ace22c8a03dd2c677bc3e6016cbe0c61d452' 
  AND (
    token = '6AFt1cyvfrGhwpJTt6FG0O91KUWsft5r7gyjOFVDF98=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00029