UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'zPWbZmPCeh5dcK3BSdXZRMXYpZCzyQM3jKhbsweud4c='
WHERE
key_id = '7149e071f00c992efebd3ca9904f9931470f18e15dff2e6ce1ed105b58a4b12e'
AND (
token = 'zPWbZmPCeh5dcK3BSdXZRMXYpZCzyQM3jKhbsweud4c='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)