UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'N+vkWgifkH/ZSJIBspWJyagLRqcNkm1FnoD7j9CNyNU='
WHERE
key_id = 'd6c22116ce21b3731c6471f61385d37a101c21ccff4c498052c2f1c431923862'
AND (
token = 'N+vkWgifkH/ZSJIBspWJyagLRqcNkm1FnoD7j9CNyNU='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)