UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'teSpMC18SsSWc4pT0lPIzpGSxuJxMyE30lOrtVP141A='
WHERE
key_id = 'd39fea9eab83868ce8501f72b40c6f05f92a31964273da7dcaaa7a03dace83a9'
AND (
token = 'teSpMC18SsSWc4pT0lPIzpGSxuJxMyE30lOrtVP141A='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)