UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'uSaionGdcSLDOEmt3ospu3snxlULhRv8buPh9+V2UMk='
WHERE
key_id = '4f48ca8d9e7e14f9a3229d098500b7d51c1800a3049469118361b91b03fa81f4'
AND (
token = 'uSaionGdcSLDOEmt3ospu3snxlULhRv8buPh9+V2UMk='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)