UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'BaTL9uh5+Y8+Up2Kxv7R42GIZ2qxEcdx9jM+tdsLAZs=' 
WHERE 
  key_id = 'd9a278c17d00198c5fe226a6239ada44cddc0befa1aacd5a71fe5b2599e6bdef' 
  AND (
    token = 'BaTL9uh5+Y8+Up2Kxv7R42GIZ2qxEcdx9jM+tdsLAZs=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00034