UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'xptsq94BdODqbg/Gl66iUcaVilPO+gFnB5b3Fq2vMYE='
WHERE
key_id = '141250fa83bf2b4a92e108e86702d4b73fa2614f7cf4aea88aa32db690d96d35'
AND (
token = 'xptsq94BdODqbg/Gl66iUcaVilPO+gFnB5b3Fq2vMYE='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)