UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'AE0y53ygsNw6FDztLstqsTz4MjEtxCDfHVlCgX+KBog='
WHERE
key_id = 'f1ac0a07a79e5b0f0eb1162f8160ef34eaee5c452ac75765fb1ebd16715aaad6'
AND (
token = 'AE0y53ygsNw6FDztLstqsTz4MjEtxCDfHVlCgX+KBog='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)