UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'MUgjq8fsfpT4k0tiTIyGLaNaaD+FK/h5gPCCu9Lqut0='
WHERE
key_id = '4ff036791883e4d863318fd452dce7c4ba31813e49810f7c0a09d09b32972feb'
AND (
token = 'MUgjq8fsfpT4k0tiTIyGLaNaaD+FK/h5gPCCu9Lqut0='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)