UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'XDgo+nRoYx3DMlicwIKakVsxdZem4T74VZ5ySIK+JSc='
WHERE
key_id = 'bcad9e2fedf75b9a5eb2d8a4ba2fef64484b43db6208fe554492a873bae35729'
AND (
token = 'XDgo+nRoYx3DMlicwIKakVsxdZem4T74VZ5ySIK+JSc='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)