UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = '0FdKpI+4ixTbQDJwdVatrKJI8mXwEjTrKg9mww1S7M4='
WHERE
key_id = 'cd6ba8c12701ec77b808a0cfde8a203eec84c291050102c2ec8629b7a3f58974'
AND (
token = '0FdKpI+4ixTbQDJwdVatrKJI8mXwEjTrKg9mww1S7M4='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)