UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'XatEnVEQZE0HLh+hOdQFJu6a23xiodFoSQufXbGbUzo=' 
WHERE 
  key_id = '4136a2324b480a73dc989fd6e505ac9b7e9ce43cba15315826ec1c75330dce27' 
  AND (
    token = 'XatEnVEQZE0HLh+hOdQFJu6a23xiodFoSQufXbGbUzo=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00031