UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'nu0T2CcnLH91mn6TDVzfl2BgAonLVm2gy/TzSFz56Nc='
WHERE
key_id = '339aace8478b393acc25640f69c549994931d31ab1b2fe85a9c54e0c7d74715c'
AND (
token = 'nu0T2CcnLH91mn6TDVzfl2BgAonLVm2gy/TzSFz56Nc='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)