UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'mdX77YW/8JXFmrgxWJkr9wCRkM9hVCjyyfd5LhBLtQQ='
WHERE
key_id = '5abc6700eca7aa875c2c10b5a0978ce1a2d4a3f644afbf90bf851f805d350444'
AND (
token = 'mdX77YW/8JXFmrgxWJkr9wCRkM9hVCjyyfd5LhBLtQQ='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)