UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'AwevJSjX7KvBTPbW0ILBfax+MNxlTTsq6Vov3J/xP1o='
WHERE
key_id = '801d49164e38665ba36e26851aeb1c0507b7d2e76bb4656eba7d5a1a9881074a'
AND (
token = 'AwevJSjX7KvBTPbW0ILBfax+MNxlTTsq6Vov3J/xP1o='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)