UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'IJCH67LWsXm/3Y68DWhMZSmAGq16CCxmkWn2vUuCwHw='
WHERE
key_id = '0335a71c8d22641058328171d9584ff1150b5e7af744de48d748c9e618ce2da5'
AND (
token = 'IJCH67LWsXm/3Y68DWhMZSmAGq16CCxmkWn2vUuCwHw='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)