UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'PYUsVgvqya6aXV0aCKw7VgIKckKTdt6jBZc/pRVNT+w='
WHERE
key_id = 'ba450ee3bc8b17c79c105b32218c36b44fc73f2d7a10ade068c43d784028f517'
AND (
token = 'PYUsVgvqya6aXV0aCKw7VgIKckKTdt6jBZc/pRVNT+w='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)