UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'PQTrhTeyGlTgHjYKGkDf4+RUquOfcb5m737pom44OSo=' 
WHERE 
  key_id = 'c5535f73205d71eeb597445889b4564327b27353cb0ed184068d341c1fa53883' 
  AND (
    token = 'PQTrhTeyGlTgHjYKGkDf4+RUquOfcb5m737pom44OSo=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00034