UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'kgdRT720FYaYURAQZXHn885D+bX7ouItTYryQxTVTt8=' 
WHERE 
  key_id = 'e7fc8dbc944f1c4f4bc68bbcbec30dfe1eba749191464f0339cbae41c4727885' 
  AND (
    token = 'kgdRT720FYaYURAQZXHn885D+bX7ouItTYryQxTVTt8=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00091