UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'QUW+auNaws+vFt0UHKtw7AKeMvxJMr6ToKzMf8U1wyo='
WHERE
key_id = 'c0636c536a42c1c1e5325b64b8e05987c41c3422018ec92d0a09ff35f3791e9a'
AND (
token = 'QUW+auNaws+vFt0UHKtw7AKeMvxJMr6ToKzMf8U1wyo='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)