UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'ZKMTm1i3eAEhL6M5BLeA0IeLhVMf+2xWeN8QPRq234E='
WHERE
key_id = 'c91ef6ae14010dd86b89680b2fce973c5c9952877db71951707e56416e3bc087'
AND (
token = 'ZKMTm1i3eAEhL6M5BLeA0IeLhVMf+2xWeN8QPRq234E='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)